package net.ge.mosq;

import java.awt.AWTException;
import java.awt.Robot;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Currency;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;

import org.apache.tools.ant.util.StringUtils;
import org.apache.xalan.templates.DecimalFormatProperties;

/**
 * @author noodles.wumu@gmail.com
 * @since 2012/07/06 11:17:29
 * @version 1.0
 */
public class Constants {

	public static final String ACCOUNT_NAME = "Name";
	public static final String ACCOUNT_CODE = "Code";
	public static final String ACCOUNT_DESCRIPTION = "Description";
	public static final String ACCOUNT_CURRENCY = "Currency";
	public static final String ACCOUNT_FRACTION = "Fraction";
	public static final String ACCOUNT_COLOR = "Color";
	public static final String ACCOUNT_NOTES = "Notes";
	public static final String ACCOUNT_PLACEHOLDER = "Placeholder";
	public static final String ACCOUNT_TYPE = "Type";
	public static final String ACCOUNT_PARENTID = "ParentId";
	public static final String ACCOUNT_EMAIL = "Email";

	public enum Parameters {

		ACC_KEY("acc-key"), ACTION_FLG("action-flg"), NAME("name"), CODE("code"), DESCRIPTION("description"), CURRENCY("currency"), NOTES("notes"), PLACEHOLDER("placeholder"), TYPE(
				"type"), PARENTNAME("parentName"), EMAIL("email"), ACCOUNT("Account"), LEVEL("level"), DISPATCHPATTREN("url-pattern");

		private String key;

		private Parameters(String key_) {
			this.key = key_;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see java.lang.Enum#toString()
		 */
		@Override
		public String toString() {
			return this.key;
		}
	}

	public enum Flag {

		INIT("0"), PERFORM("1");

		private String key;

		private Flag(String key_) {
			this.key = key_;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see java.lang.Enum#toString()
		 */
		@Override
		public String toString() {
			return this.key;
		}
	}

	public enum Entities {

		NAME("name"), CODE("code"), DESCRIPTION("description"), CURRENCY("currency"), NOTES("notes"), PLACEHOLDER("placeholder"), TYPE("type"), PARENTNAME("parentName"), EMAIL(
				"email"), ACCOUNT("Account"), LEVEL("level"), DISPATCHPATTREN("url-pattern");

		private String key;

		private Entities(String key_) {
			this.key = key_;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see java.lang.Enum#toString()
		 */
		@Override
		public String toString() {
			return this.key;
		}

	}

	public enum Config {

		ACCOUNT_TYPES_FILE_NAME("account-types.xml");

		private String key;

		private Config(String key_) {
			this.key = key_;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see java.lang.Enum#toString()
		 */
		@Override
		public String toString() {
			return this.key;
		}
	}

	public static void main(String[] args) {

		Locale[] ls = Locale.getAvailableLocales();

		Arrays.sort(ls, new Comparator<Locale>() {
			@Override
			public int compare(Locale o1, Locale o2) {
				return o1.getCountry().compareTo(o2.getCountry());
			}
		});
		for (int i = 0; i < ls.length; i++) {
			Locale l = ls[i];
			if (org.apache.commons.lang.StringUtils.isNotBlank(l.getCountry()) && (i == 0 || !ls[i - 1].getCountry().equals(l.getCountry()))) {
				System.out.println(DecimalFormat.getCurrencyInstance(l).getCurrency().getCurrencyCode() + " (" + l.getDisplayCountry(l) + ")");
			}

		}

		 try {
		 System.out.println(new
		 BigDecimal(DecimalFormat.getCurrencyInstance(Locale.JAPAN).parse(DecimalFormat.getCurrencyInstance(Locale.JAPAN).format(new BigDecimal("1232131231.386587"))).toString()).toString());
		 } catch (ParseException e) {
		 // TODO Auto-generated catch block
		 e.printStackTrace();
		 }
	}
	
	public static final String USER_LOCALE = "net.ge.mosq.LOCALE";
}
